package com.zg.nacos.domain.req;

import com.zg.common.core.req.BaseReq;
import com.zg.common.core.req.IReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 * <p>Description: </p>
 *
 * @author zhanfeng.liang
 * @since 2025/6/24 19:09
 */
@Data
@ApiModel(value = "InstanceInfoReq", description = "Nacos 服务实例信息DTO")
public class InstanceInfoReq extends NacosReq {

    @ApiModelProperty(value = "服务名称", example = "zg-apis")
    @NotEmpty(message = "服务名称不能为空")
    private String serviceName;

    @ApiModelProperty(value = "集群名称", example = "DEFAULT")
    @NotEmpty(message = "集群名称不能为空")
    private String clusterName;

    @ApiModelProperty(value = "分组名称", example = "DEFAULT_GROUP")
    @NotEmpty(message = "分组名称不能为空")
    private String groupName;

    @ApiModelProperty(value = "IP地址", example = "192.168.137.124")
    @NotEmpty(message = "IP地址不能为空")
    private String ip;

    @ApiModelProperty(value = "端口", example = "8091")
    @NotNull(message = "端口不能为空")
    private Integer port;

    @ApiModelProperty(value = "是否临时实例", example = "true")
    @NotNull(message = "是否临时实例不能为空")
    private Boolean ephemeral;

    @ApiModelProperty(value = "权重", example = "1")
    @NotNull(message = "权重不能为空")
    private Integer weight;

    @ApiModelProperty(value = "true为上线，false为下线", example = "false")
    @NotNull(message = "是否启用不能为空")
    private Boolean enabled;

    @ApiModelProperty(value = "元数据", example = "{\"preserved.register.source\":\"SPRING_CLOUD\"}")
    @NotEmpty(message = "元数据不能为空")
    private Map metadata;

    @ApiModelProperty(value = "命名空间ID", example = "back")
    @NotEmpty(message = "命名空间ID不能为空")
    private String namespaceId;
}
